// todo 创建路由  配置路由规则  导出路由实例对象

// 导入页面
import Vue from 'vue'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import Play from '@/views/Play'


import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/layout'
},
{
  path: '/layout',
  component: Layout, 
  redirect: '/layout/home',

  //二级路由
  children: [
    {
      path: 'home',
      component: Home,
      meta: { // meta保存路由对象额外信息的
        title: "首页"
      }
    },
    {
      path: 'search',
      component: Search,
      meta: {
        title: "搜索"
      }
    }
  ],

},

{
  path: '/paly',
  component: Play
},

]

const router = new VueRouter({
  routes
})



//默认导出
export default router